package com.dragon.modules.yuegou.utils;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.dragon.common.api.result.PageResult;
import com.dragon.common.web.PageRequest;

public class PageToResultUtils {

    public static void pageToResult(IPage page, PageResult result){
        result.setSize((int)page.getSize());
        result.setCurrent((int)page.getCurrent());
        result.setPages((int)page.getPages());
        result.setTotal(page.getTotal());
    }

    public static IPage resultToPage(PageRequest result){
        return new Page<>(result.getPage(),result.getSize(),result.getCount());
    }

}
